Particle Filter Tracking a Biker in a City
Jonas Sjöberg, PhD
Chalmers University of Technology, Göteborg, Sweden

This demonstration illustrates the use of a particle filter for tracking a biker using only noise measurements of the position. 

You define the true trajectory of the biker by choosing any of the two first buttons and using the mouse. Make sure to stay on the streets. The first button also gives you an on-line estimation at the same time as you give define the trajectory. Given a trajectory, by choosing the third button, you can test different filter settings and see the estimated trajectory. The claud of red particles illustrates the probability density. Lighter red particles are less probable.

The filter recieves noisy velocity measurments as input and returns estimated positions. You can set the following parameters:
- Measuement noise:σv
- The filter process noise: σw
- Number of particles (more than 200 is normally required to obtain a good tracking)
- Resampling thresshold (0 gives resampling each iteration)
- The filter is initialized with the true position and velocity, or randomly (which requires more particles).

By indicating with checkboxes, you can choose the information which is displayed.
- Measuerment: A pure integration of the velocity measueremts is shown. The measurmens available to the filter are the distances between the points.
- True Position: The trajectory you mark with the mouse. This is the trajectory the filter should track as good as possible.
- Estimate: The estimated trajectory based on a weighted mean of all the particles.
- Variance: an elipse is shown around the estimate indicating the uncertainty.
- Random Guess: The initial positions of the particles are spread out through-out the city instead of having them at the correct initial position. This corresponds to the case that we have no idea where in the city the biker starts, and the challenge becomes to localize them using only velocity measurements and the map.

More information

Briefly, a particle filter is a probabilistic filter where the probability density is represented by a number of samples, i.e., the particles. This makes it possible to handle problems where no standard distribution (typically a Gaussian) describes the distributions well. An example is when you have two branches in a tracking and both branches are probable, but the probability is zero between the branches. Each particle in the particle filter corresponds to on realization of the possible outcome, and it is the weightening of all particles which makes up the estimate. Measurements are used to indicate the probability of each individual particle.

More about particle filters can be found, e.g., in Branko, R., Arulampalam, S., Gordon, N., (2004). “Beyond the Kalman Filter” Artech House, Boston, Mass; London.

The underlying model used in this example is a constant velocity model, i.e., the biker is assumed to move in a straight line. The velocity and direction are changed by the process noise which is added to each particle at each sampling time. In this way the particles spread with time, and they spread faster if you set the process noise higher.

The filter also makes use of the map of the city, and particles which are not longer on the road are given the probability zero and they are not longer contributing to the estimate. Sometimes the filter performs a re-sampling of the particles (you can influence this with the parameter "re-sampling", 1 corresponds to a re-sampling each sampling instant). At the re-sampling all the particles with zero probability are removed and replaced by new one at the more probable places. If you set "re-sampling" slightly smaller than 1 you should be able to see when a res-sampling takes place, and the spread of the new particles after a re-sampling.

If you play around with the filter you should be able to see that most of the information about the true position is given in connection to that the biker makes turns in crossings. Hence, if you generate trajectories with many turns,the filter should be able to obtain better estimates.

Remarks:
- The tuning parameters of the filter: number of particles, process noise and measurement noise are crucial to obtain a good tracking. Best values for them typically depends on how fast the biker is, i.e., the distance between the sampling points you generate, how fast the speed and direction change.

- The trajectory indicated "Measurements" corresponds to a simple sum of all velocity measurement without any feedback from the map. This trajectory starts at the true initial points and, hence, it will always be good at the beginning. The goal of the filter is to obtain an estimation of the true trajectory which is as good as possible.

- Sometimes the demo crashes. This can for example, depend on that all particles lost their probability. You often get this if you start with a random initialization in combination with a low number of particles.